﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using GS.DataConnection;

namespace GS.CMS.Entities
{
    public class Question
    {
        public DataSet GetListQuestion(int pgNum)
        {
            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            ht.Add("@pgNum", pgNum);
            return SqlProvider.GetDataSet("pro_question_list", "dsQuestion", ht);
        }
        public DataTable GetQuestionByID(int QuestionID)
        {
            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            ht.Add("@QuestionID", QuestionID);
            return SqlProvider.GetTable("pro_question_get_by_id", "dtQuestion", ht);
        }
        public int UpdateQuestionByID(int QuestionID, string Header, string Ask, string SenderName, string Email
        )
        {
            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            ht.Add("@QuestionID", QuestionID);
            ht.Add("@n_Ask", Ask);
            ht.Add("@n_Header", Header);
            ht.Add("@nt_Answer", "");
            ht.Add("@n_FullName", SenderName);
            ht.Add("@IsActived", false);
            ht.Add("@Email", Email);
            return int.Parse(SqlProvider.ExecuteScalar("pro_question_update", ht).ToString());
        }
    }
}
